package com.imooc.security.log;

import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

/**
 * @ClassName AuditLog
 * @Description TODO 审计日志
 * @Author wushaopei
 * @Date 2021/5/1 17:56
 * @Version 1.0
 */
@Entity
@Data
@EntityListeners(AuditingEntityListener.class) // 注入审计监听器
public class AuditLog {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String method;

    private String path;

    private Integer status;

    // 当前用户
    @CreatedBy
    private String username;

    @Temporal(TemporalType.TIMESTAMP)
    @CreatedDate
    private Date createTime;

    @Temporal(TemporalType.TIMESTAMP)
    @CreatedDate
    private Date modifyTime;
}
